<template>
    <div class="dialog">
        <lb-header :title="'发布'"></lb-header>
        <input type="text" placeholder="请输入用户名" v-model="name">
        <input type="text" placeholder="请输入标题" v-model="title">
        <input type="text" placeholder="请输入内容" v-model="con">
        <button class="public" @click="public">发布</button>
    </div>
</template>

<script>
import LbHeader from '@/components/lbHeader'
import axios from 'axios'
export default {
    components:{
        LbHeader
    },
    data(){
        return {
            name:'',
            title:'',
            con:''
        }
    },
    methods:{
        public(){
            axios.post('/api/add',{name:this.name,title:this.title,con:this.con}).then((res) =>{
                if(res.data.code === 1){
                    this.bus.$emit('close');
                }
            })
        }
    }
}
</script>
<style>
    .dialog{
        width:100%;
        height: 100%;
        position: absolute;
        top:0;
        left:0;
        background: rgba(0,0,0,.7);
    }
</style>

